SCForm = sCore.makeClass(Container,{
    init : function() {
        SCForm.parentClass.init.apply(this,arguments);
    },
    create : function() {
        SCForm.parentClass.create.apply(this,arguments);
        var i,cc=this.children;
        for (i in cc) cc[i].click($.proxy(this.formField_OnClick,this));
    },
    validate : function() {
        var i,cc=this.selectChilrenOfType([FormField]),valid = true;
        for (i in cc) valid = cc[i].validate()&&valid;
        return valid;
    },
    formField_OnClick : function(e) {
        var i,cc=this.children,v,t = e.currentTarget.$;
        if (t.name!='Submit') return;
        e.preventDefault();
        e.stopPropagation();
        e.stopImmediatePropagation();
        if (!this.validate()) {
            for (i in cc) 
                if (v = cc[i]._failedValidator) {
                    v.updateErrorlabel();
                }
        } else{
            this.triggerEvent('submit');
        }
    }
});
Form = sCore.makeClass(SCForm,{});